<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改物资仓储出入记录')" />
	<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-ncGoodsLog-edit" th:object="${ncGoodsLog}">
            <input id="goodsLogId" name="goodsLogId" th:field="*{goodsLogId}"  type="hidden">
			<!--<div class="form-group">
				<label class="col-sm-3 control-label">物资批次：</label>
				<div class="col-sm-8">
					<input id="goodsCode" name="goodsCode" th:field="*{goodsCode}" class="form-control" type="text">
				</div>
			</div>-->
			<input name="meterialId"  th:field="*{meterialId}" type="hidden"  />
			<!--<div class="form-group">

				<label class="col-sm-3 control-label">物品名称：</label>
				<div class="col-sm-8">
					<div class="input-group">
						<input name="meterialName" onclick="selectMeterialTree()" id="treeName" type="text"  placeholder="请选择" th:field="*{meterialName}" class="form-control" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
				</div>

			</div>-->
			<div class="form-group">
				<label class="col-sm-3 control-label">出库数量：</label>
				<div class="col-sm-8">
					<input id="outputAmount" name="outputAmount" th:field="*{outputAmount}" class="form-control" type="number"
						   onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">入库量：</label>
				<div class="col-sm-8">
					<input id="inputAmount" name="stockAmout" th:field="*{inputAmount}" readonly="true" class="form-control" type="text">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">库存：</label>
				<div class="col-sm-8">
					<input id="stockAmout" name="stockAmout" th:field="*{stockAmout}" class="form-control" type="number"
						   onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">领用人：</label>
				<div class="col-sm-8">

					<select id="receiver" class="form-control select2-multiple" name="receiver">
						<option th:each="user:${receiver}" th:value="${user.userId}" th:text="${user.userName}"
								th:selected="${user.flag}" th:disabled="${user.status == '1'}"></option>
					</select>
				</div>
				<!--<div class="col-sm-8">
					<input id="receiver" name="receiver" th:field="*{receiver}" class="form-control" type="text">
				</div>-->
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">有效期</label>
				<div class="col-sm-8">
					<input id="createTime" data-format="yyyy-MM-dd HH:mm:ss" data-type="datetime" required  name="createTime" placeholder="请选择时间"th:value="*{#dates.format(createTime, 'yyyy-MM-dd HH:mm:ss')}"  class="form-control" type="text" th:class="time-input"   >
				</div>

				<!--<label class="col-sm-3 control-label">时间：</label>
				<div class="col-sm-8">
					<input id="createTime" name="createTime" th:field="*{createTime}" class="form-control" type="text">
				</div>-->
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">采购人：</label>
				<div class="col-sm-8">
					<select id="purchaser" class="form-control select2-multiple" name="purchaser">
						<option th:each="user:${purchaser}" th:value="${user.userId}" th:text="${user.userName}"
								th:selected="${user.flag}" th:disabled="${user.status == '1'}"></option>
					</select>

					<!--<input id="purchaser" name="purchaser" th:field="*{purchaser}" class="form-control" type="text">-->
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">入库人：</label>
				<div class="col-sm-8">
					<select id="createBy" class="form-control select2-multiple" name="createBy">
						<option th:each="user:${createBy}" th:value="${user.userId}" th:text="${user.userName}"
								th:selected="${user.flag}" th:disabled="${user.status == '1'}"></option>
					</select>

					<!--<input id="createBy" name="createBy" th:field="*{createBy}" class="form-control" type="text">-->
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<textarea id="remark" name="remark" th:field="*{remark}" rows="4" class="form-control" type="text"></textarea>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
	<th:block th:include="include :: select2-js" />
    <script type="text/javascript">
		var prefix = ctx + "system/ncGoodsLog";
		$("#form-ncGoodsLog-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			focusCleanup: true
		});

		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-ncGoodsLog-edit').serialize());
	        }
	    }

		//物资选择树
		function selectMeterialTree() {
			var treeId = $("#treeId").val();
			var meterialId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
			var url = ctx + "system/meterial/selectMeterialTree/" + meterialId;
			var options = {
				title: '物资选择',
				width: "380",
				url: url,
				callBack: doSubmit
			};
			$.modal.openOptions(options);
		}

		function doSubmit(index, layero) {
			var body = layer.getChildFrame('body', index);
			$("#treeId").val(body.find('#treeId').val());
			$("#treeName").val(body.find('#treeName').val());
			layer.close(index);
		}

	</script>
</body>
</html>
